import Data.Ord
import Data.List

euler_039 = fst $ maximumBy (comparing snd) $ map (\x->(head x,length x)) $ (group.sort) [a+b+c | a <- [1..1000], b <- [a..(1000-a)], c <- [b..(1000-a-b)], a*a + b*b == c*c] 